from django.db import models
from test.models import Test
from question.models import Question
from django.contrib.auth.models import User

class UserAnswer(models.Model):
    date = models.DateTimeField(null=False)
    user = models.ForeignKey(User, null=True, db_column='user', blank=False)
    test = models.ForeignKey(Test, null=True, db_column='test', blank=False)
    question = models.ForeignKey(Question, related_name='+', null=True, db_column='question', blank=True)
    answer = models.CharField(max_length=255, null=True, db_column='answer', blank=False)
    class Meta:
        db_table = u'user_answers'